// 引入等比适配插件
const px2rem = require('postcss-px2rem')

// 配置基本大小
const postcss = px2rem({
  // 基准大小 baseSize，需要和rem.js中相同
  remUnit: 16
})
module.exports = {
  publicPath: './',
  outputDir: 'dist',
  assetsDir: 'static',
  lintOnSave: false,
  css: {
    loaderOptions: {
      postcss: {
        plugins: [postcss]
      }
    }
  },
  configureWebpack: config => {
    if (process.env.NODE_ENV === 'production') {
      config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
    }
  },
  // css: {
  //   loaderOptions: {
  //     css: {},
  //     postcss: {
  //       plugins: [
  //         require('postcss-px2rem')({
  //           remUnit: 54
  //         src: 'src/*.css',
  //         dest: 'build'
  //       }
  //     }
  //   }
  // },
  devServer: {
    // proxyTable: {
    //   "/api": {
    //     target: "http://10.240.153.208",
    //     changeOrigin: true,
    //     pathRewrite: {
    //       "^/api": "/api"
    //     }
    //   }
    // },
    disableHostCheck: false,
    host: '0.0.0.0',
    port: 8086,
    https: false,
    hotOnly: false,
    proxy: {
      '/api': {
        // target: "http://10.240.184.177:80",
        target: 'http://pack.neox.netease.com',
        changeOrigin: true,
        pathRewrite: {
          '^/api': '/api'
        }
      }
    }
  }
}
